package day03;

public class IfElseIfDemo {
    public static void main(String[] args) {
        //分支结构: if...elseif...
        //满2000打五折，满1000不满2000打七折，满500不满1000打八折，不满500打九折
        double price1=6000.0;//带数(6000.0,1000.0,700.0,300.0)
        if(price1>=2000){
            price1*=0.5;
        } else if (price1>=1000 && price1<2000) {
            price1*=0.7;
        } else if (price1>=500 && price1<1000) {
            price1*=0.8;
        } else {
            price1=price1*0.9;
        }
        System.out.println("最终结算金额为"+price1);
        double price2=1000.0;
        if(price2>=2000){
            price2*=0.5;
        } else if (price2>=1000) {
            price2*=0.7;
        } else if (price2>=500) {
            price2*=0.8;
        } else {
            price2=price2*0.9;
        }
        System.out.println("最终结算金额为"+price2);

        double price3=700.0;
        if (price3>=2000){
            price3*=0.5;
        } else if (price3 >=1000) {
            price3*=0.7;
        } else if (price3>=500) {
            price3*=0.8;
        }else {
            price3*=0.9;
        }
        System.out.println("最终结算金额为"+price3);

        double price4=300.0;
        if(price4>=2000){
            price4*=0.5;
        } else if (price4>=1000) {
            price4*=0.7;
        } else if (price4>=500) {
            price4*=0.8;
        }else {
            price4*=0.9;
        }
        System.out.println("最终结算金额为"+price4);
    }
}